/*添加部门*/
'use strict';
const userDepartmentAddAction = require('../actions/adminUserManagement/userDepartment/userDepartmentAddAction');
const userDepartmentUpdateAction = require('../actions/adminUserManagement/userDepartment/userDepartmentUpdateAction');
const userDepartmentQueryAction = require('../actions/adminUserManagement/userDepartment/userDepartmentQueryAction');
const userDepartmentDelAction = require('../actions/adminUserManagement/userDepartment/userDepartmentDelAction');

module.exports = async function (ctx) {
    let param = ctx.method === 'GET' ? ctx.query : ctx.request.fields;
    let action_type = param.action_type;
    try {
        switch (action_type) {
            case 'userDepartmentAdd': //
                ctx.body = await userDepartmentAddAction(param);
                break;
            case 'userDepartmentUpdate': //
                ctx.body = await userDepartmentUpdateAction(param);
                break;
            case 'userDepartmentQuery': //
                ctx.body = await userDepartmentQueryAction(param);
                break;
            case 'userDepartmentDel': //
                ctx.body = await userDepartmentDelAction(param);
                break;

        }
    } catch (e) {
        ctx.body = {success: false, message: e.message};
    }

};